<?php
$q = $_GET['q'];

$con =mysqli_connect('localhost','root','','db4208');
if (!$con) {
  die('Could not connect: ' . mysqli_error($con));
}

mysqli_select_db($con,"sem_data");
$sql="SELECT * FROM sem_data WHERE course_number = '".$q."'";
//$sql="SELECT * FROM sem_data WHERE course_number = 'CSCI5125'";
$result = mysqli_query($con,$sql);
$name ="";
while ($row = mysqli_fetch_array($result)) {
 $values = array_values($row);
$name = $row['course_name'] . " $$ " .$row['semester'] . " $$ " .$row['year'] . " $$ " .$row['grade']." $$ ".$row['area'];

// echo"<td><input type='text'size = '30' name='dept' value='".$values['4']."'></td>";
// echo "<td><select id='semester' width='50px'>
// <option value='".$values[6]."' >".$values[6]."</option>
// </select> </td>";
// //echo"<td><input type='text'size = '8' name='dept' value='".$values[6]."'></td>";
//     echo"<td><input type='text'size = '8' name='dept' value='".$values[8]."'></td>";
//     echo"<td><input type='text'size = '6' name='dept' value='".$values[10]."'></td>";
//     echo"<td><input type='text'size = '6' name='dept' value='".$values[12]."'></td>";
}
echo $name;
mysqli_close($con);
?>